<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Calico: calico::Trajectory Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Calico
   </div>
   <div id="projectbrief">A visual-inertial calibration library designed for rapid problem construction and debugging.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacecalico.html">calico</a></li><li class="navelem"><a class="el" href="classcalico_1_1Trajectory.html">Trajectory</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="classcalico_1_1Trajectory-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">calico::Trajectory Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="trajectory_8h_source.html">trajectory.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a68f4f44651441e3d77bb13cd5b07cce7"><td class="memItemLeft" align="right" valign="top">absl::Status&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#a68f4f44651441e3d77bb13cd5b07cce7">FitSpline</a> (const absl::flat_hash_map&lt; double, <a class="el" href="classcalico_1_1Pose3.html">Pose3d</a> &gt; &amp;poses_world_sensorrig, double knot_frequency=<a class="el" href="classcalico_1_1Trajectory.html#ab50b8748cad2ad68a9e3800a56a14aa8">kDefaultKnotFrequency</a>, int spline_order=<a class="el" href="classcalico_1_1Trajectory.html#a24009abb70b9197145dfeb5e6f589b51">kDefaultSplineOrder</a>)</td></tr>
<tr class="separator:a68f4f44651441e3d77bb13cd5b07cce7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b3008b06c6bb5e9480a3131ad8a3f13"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#a7b3008b06c6bb5e9480a3131ad8a3f13">AddParametersToProblem</a> (ceres::Problem &amp;problem)</td></tr>
<tr class="separator:a7b3008b06c6bb5e9480a3131ad8a3f13"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abce44ba657a445b2a73988c4788f0240"><td class="memItemLeft" align="right" valign="top"><a id="abce44ba657a445b2a73988c4788f0240"></a>
const <a class="el" href="classcalico_1_1BSpline.html">BSpline</a>&lt; 6 &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#abce44ba657a445b2a73988c4788f0240">spline</a> () const</td></tr>
<tr class="memdesc:abce44ba657a445b2a73988c4788f0240"><td class="mdescLeft">&#160;</td><td class="mdescRight">Accessors for the spline. <br /></td></tr>
<tr class="separator:abce44ba657a445b2a73988c4788f0240"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d1f75af0c4250fbbdeac8da6dce36f3"><td class="memItemLeft" align="right" valign="top"><a id="a9d1f75af0c4250fbbdeac8da6dce36f3"></a>
<a class="el" href="classcalico_1_1BSpline.html">BSpline</a>&lt; 6 &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>spline</b> ()</td></tr>
<tr class="separator:a9d1f75af0c4250fbbdeac8da6dce36f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac20a0fc8fb0aabd138d34dd2935c8cf2"><td class="memItemLeft" align="right" valign="top">absl::StatusOr&lt; std::vector&lt; <a class="el" href="classcalico_1_1Pose3.html">Pose3d</a> &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#ac20a0fc8fb0aabd138d34dd2935c8cf2">Interpolate</a> (const std::vector&lt; double &gt; &amp;interp_times) const</td></tr>
<tr class="separator:ac20a0fc8fb0aabd138d34dd2935c8cf2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a03de815880e8367a6c110dace3b20090"><td class="memItemLeft" align="right" valign="top"><a id="a03de815880e8367a6c110dace3b20090"></a>
const absl::flat_hash_map&lt; double, <a class="el" href="classcalico_1_1Pose3.html">Pose3d</a> &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#a03de815880e8367a6c110dace3b20090">trajectory</a> () const</td></tr>
<tr class="memdesc:a03de815880e8367a6c110dace3b20090"><td class="mdescLeft">&#160;</td><td class="mdescRight">Setter/getter for the internal map between timestamp and pose. <br /></td></tr>
<tr class="separator:a03de815880e8367a6c110dace3b20090"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a18b5725c67dc3eb84def878ab07dbcd4"><td class="memItemLeft" align="right" valign="top"><a id="a18b5725c67dc3eb84def878ab07dbcd4"></a>
absl::flat_hash_map&lt; double, <a class="el" href="classcalico_1_1Pose3.html">Pose3d</a> &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>trajectory</b> ()</td></tr>
<tr class="separator:a18b5725c67dc3eb84def878ab07dbcd4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad402e9a34842a3cf98e944415868a7e5"><td class="memItemLeft" align="right" valign="top"><a id="ad402e9a34842a3cf98e944415868a7e5"></a>
<a class="el" href="structcalico_1_1TrajectoryEvaluationParams.html">TrajectoryEvaluationParams</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#ad402e9a34842a3cf98e944415868a7e5">GetEvaluationParams</a> (double stamp) const</td></tr>
<tr class="memdesc:ad402e9a34842a3cf98e944415868a7e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the parameters needed to evaluate the spline for a given timestamp. <br /></td></tr>
<tr class="separator:ad402e9a34842a3cf98e944415868a7e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a60aa4cc5ee41e985c83259612e036530"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a60aa4cc5ee41e985c83259612e036530"><td class="memTemplItemLeft" align="right" valign="top">static <a class="el" href="classcalico_1_1Pose3.html">Pose3</a>&lt; T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#a60aa4cc5ee41e985c83259612e036530">VectorToPose3</a> (const Eigen::Vector&lt; T, 6 &gt; &amp;vector)</td></tr>
<tr class="separator:a60aa4cc5ee41e985c83259612e036530"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:a24009abb70b9197145dfeb5e6f589b51"><td class="memItemLeft" align="right" valign="top"><a id="a24009abb70b9197145dfeb5e6f589b51"></a>
static constexpr int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#a24009abb70b9197145dfeb5e6f589b51">kDefaultSplineOrder</a> = 6</td></tr>
<tr class="memdesc:a24009abb70b9197145dfeb5e6f589b51"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default spline order of 6. <br /></td></tr>
<tr class="separator:a24009abb70b9197145dfeb5e6f589b51"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab50b8748cad2ad68a9e3800a56a14aa8"><td class="memItemLeft" align="right" valign="top"><a id="ab50b8748cad2ad68a9e3800a56a14aa8"></a>
static constexpr double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcalico_1_1Trajectory.html#ab50b8748cad2ad68a9e3800a56a14aa8">kDefaultKnotFrequency</a> = 10</td></tr>
<tr class="memdesc:ab50b8748cad2ad68a9e3800a56a14aa8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default knot frequency at 10Hz. <br /></td></tr>
<tr class="separator:ab50b8748cad2ad68a9e3800a56a14aa8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classcalico_1_1Trajectory.html">Trajectory</a> class. Takes in discrete world-from-sensorrig poses and encodes them as a 6-DOF B-Spline. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a7b3008b06c6bb5e9480a3131ad8a3f13"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b3008b06c6bb5e9480a3131ad8a3f13">&#9670;&nbsp;</a></span>AddParametersToProblem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int calico::Trajectory::AddParametersToProblem </td>
          <td>(</td>
          <td class="paramtype">ceres::Problem &amp;&#160;</td>
          <td class="paramname"><em>problem</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Add internal parameters to a ceres problem. Any internal parameters set to constant are marked as such in the problem. Returns the total number of parameters added to the problem. </p>

</div>
</div>
<a id="a68f4f44651441e3d77bb13cd5b07cce7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a68f4f44651441e3d77bb13cd5b07cce7">&#9670;&nbsp;</a></span>FitSpline()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">absl::Status calico::Trajectory::FitSpline </td>
          <td>(</td>
          <td class="paramtype">const absl::flat_hash_map&lt; double, <a class="el" href="classcalico_1_1Pose3.html">Pose3d</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>poses_world_sensorrig</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>knot_frequency</em> = <code><a class="el" href="classcalico_1_1Trajectory.html#ab50b8748cad2ad68a9e3800a56a14aa8">kDefaultKnotFrequency</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>spline_order</em> = <code><a class="el" href="classcalico_1_1Trajectory.html#a24009abb70b9197145dfeb5e6f589b51">kDefaultSplineOrder</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Add discrete poses representing a time-parameterized trajectory. A new spline will be fit to these poses with a specified knot frequency and spline order. Returns <code>absl::OkStatus()</code> if successful, an error otherwise. <br  />
<br  />
<code>poses_world_body</code> is a map between a <code>double</code> timestamp in seconds and <code>Pose3d</code> world-from-sensorrig 6-DOF pose: </p><p class="formulaDsp">
\[ \mathbf{T}^w_r(t) = \left[\begin{matrix}\mathbf{R}^w_r&amp;\mathbf{t}^w_{wr}\\ \mathbf{0}&amp;1\end{matrix}\right] \]
</p>
<p> <code>knot_frequency</code> is the knot rate of the spline. If <code>poses_world_body</code> contains timestamps spanning from \(t_0\) to \(t_f\) seconds, this function will yield a spline with \(n_{knots} = \left(t_f - t_0\right) \left(\text{knot_frequency}\right)\)<br  />
<br  />
<code>spline_order</code> is the order of the spline. A spline order of \(n\) implies that the pose at any given time is: </p><p class="formulaDsp">
\[ \mathbf{T}^w_r(t) = \left[\begin{matrix}\boldsymbol{\Phi}^w_r(t)\\\ \mathbf{t}^w_{wr}(t)\end{matrix}\right] = \mathbf{c}_{i,0} + \mathbf{c}_{i,1}t + ... + \mathbf{c}_{i,n}t^n \]
</p>
<p> where \(\mathbf{c}_{i,j}\) is the j'th control point for the i'th spline segment. </p>

</div>
</div>
<a id="ac20a0fc8fb0aabd138d34dd2935c8cf2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac20a0fc8fb0aabd138d34dd2935c8cf2">&#9670;&nbsp;</a></span>Interpolate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">absl::StatusOr&lt; std::vector&lt; <a class="el" href="classcalico_1_1Pose3.html">Pose3d</a> &gt; &gt; calico::Trajectory::Interpolate </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; double &gt; &amp;&#160;</td>
          <td class="paramname"><em>interp_times</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Interpolate the trajectory at given timestamps. Returns a vector of world-from-sensorrig poses evaluated in the order of the timestamps. Returns an error if something went wrong during interpolation. For example, attempting to interpolate on out-of-bounds timestmaps. <br  />
<br  />
<code>interp_times</code> is the timestamps to query the spline. No assumptions are made about order. </p>

</div>
</div>
<a id="a60aa4cc5ee41e985c83259612e036530"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a60aa4cc5ee41e985c83259612e036530">&#9670;&nbsp;</a></span>VectorToPose3()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classcalico_1_1Pose3.html">Pose3</a>&lt;T&gt; calico::Trajectory::VectorToPose3 </td>
          <td>(</td>
          <td class="paramtype">const Eigen::Vector&lt; T, 6 &gt; &amp;&#160;</td>
          <td class="paramname"><em>vector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Convert a 6-DOF vector to <a class="el" href="classcalico_1_1Pose3.html">Pose3</a> type. First three elements of the vector are expected to be an \(SO(3)\) log map vector, and the last three are the position values.<br  />
<br  />
 </p><p class="formulaDsp">
\[ \text{vector}=\left[\begin{matrix}\boldsymbol{\Phi}\\\mathbf{t}\end{matrix}\right]\\ \boldsymbol{\Phi} = \left[\begin{matrix}\Phi_x\\\Phi_y\\\Phi_z\end{matrix}\right]\\ \mathbf{R} = \exp\left([\boldsymbol{\Phi}]_\times\right)\\ \left[\boldsymbol{\Phi}\right]_\times = \left[\begin{matrix}0 &amp;-\Phi_z&amp;\Phi_y\\ \Phi_z&amp;0&amp;-\Phi_x\\ -\Phi_y&amp;\Phi_x&amp;0\end{matrix}\right] \]
</p>
 
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>calico/<a class="el" href="trajectory_8h_source.html">trajectory.h</a></li>
<li>calico/trajectory.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
